// This file was decompiled using SASCM.ini published on 2021-07-05
{$CLEO .csa}

0000: NOP

script_name "copsweapon" 
wait 0
04ED: load_animation "weaponcop"
038B: load_requested_models   

:weaponcop1
wait 0 
if
   Player.Defined($PLAYER_CHAR) 
jf @weaponcop1
wait 0 
if and
$ONMISSION == 0
   not Actor.Driving($PLAYER_ACTOR)
810F:   not player $PLAYER_CHAR wanted_level > 0
04EE:   animation "weaponcop" loaded
jf @weaponcop1
jump @weaponcop01

:weaponcop01
0470: 0@ = actor $PLAYER_ACTOR current_weapon
if or
  0@ == 4 
  0@ == 5
  0@ == 22
  0@ == 23
  0@ == 24
  0@ == 9
  0@ == 8
jf @weaponcop012 
jump @weaponcop001

:weaponcop012  
if or
  0@ == 18 
  0@ == 25
  0@ == 26
  0@ == 27
  0@ == 28
  0@ == 29
  0@ == 30
jf @weaponcop013 
jump @weaponcop001

:weaponcop013   
if or
  0@ == 31 
  0@ == 32
  0@ == 33
  0@ == 34
  0@ == 35
  0@ == 36
  0@ == 37
jf @weaponcop014 
jump @weaponcop001
  
:weaponcop014    
if or
  0@ == 38 
  0@ == 39
  0@ == 16
jf @weaponcop1 
jump @weaponcop001

:weaponcop001
wait 0 
if 
06FF:   any_ped_near_actor $PLAYER_ACTOR in_range 10.0 
jf @weaponcop1
Actor.StorePos($PLAYER_ACTOR, 1@, 2@, 3@)
0A3E: unknown_get_actor_in_sphere 1@ 2@ 3@ radius 8.0 8.0 5.0 handle_as 4@ 
if
056D:   actor 4@ defined 
jf @weaponcop1
089F: get_actor 4@ pedtype_to 5@
if
  5@ == 6 
jf @weaponcop_end 
0390: load_txd_dictionary 'weapcs'
038F: load_texture "nar1" as 1
038F: load_texture "nar2" as 2
038F: load_texture "cop1" as 3
wait 500
jump @weaponcop2

:weaponcop_end
wait 500
Actor.RemoveReferences(4@)
jump @weaponcop1

:weaponcop_end2
wait 500
0391: release_txd_dictionary 
0647: AS_actor 4@ clear_look_task
Actor.RemoveReferences(4@)
jump @weaponcop1

:weaponcop2 
7@ = 0 

:weaponcop3
wait 0
if and
$ONMISSION == 0 
0104:   actor $PLAYER_ACTOR near_actor 4@ radius 10.0 10.0 5.0 sphere 0
jf @weaponcop_end2
03F0: enable_text_draw 1
03E3: set_texture_to_be_drawn_antialiased 1 
038D: draw_texture 2 position 570.0 140.0 scale 100.0 40.0 RGBA 7@ 7@ 7@ 7@ 
03E3: set_texture_to_be_drawn_antialiased 1 
038D: draw_texture 1 position 570.0 140.0 scale 100.0 40.0 RGBA 255 255 255 255 
jump @weaponcop4

:weaponcop4
05BF: AS_actor 4@ look_at_actor $PLAYER_ACTOR -1 ms
7@ += 1
if
   7@ >= 255
jf @weaponcop6
22@ = player.Money($PLAYER_CHAR)
jump @weaponcop632

:weaponcop6
0470: 0@ = actor $PLAYER_ACTOR current_weapon
if or
  0@ == 0
  0@ == 1
  0@ == 3
  0@ == 5
  0@ == 41
  0@ == 42
  0@ == 43
jf @weaponcop666
jump @weaponcop_end2

:weaponcop666
if
810F:   not player $PLAYER_CHAR wanted_level > 0
jf @weaponcop_end2
jump @weaponcop434

:weaponcop434
if
0457:   player $PLAYER_CHAR aiming_at_actor 4@
jf @weaponcop435
wait 0
010D: set_player $PLAYER_CHAR wanted_level_to 1
jump @weaponcop_end2

:weaponcop435
if
Actor.Driving($PLAYER_ACTOR)
jf @weaponcop3
wait 0
010D: set_player $PLAYER_CHAR wanted_level_to 1
jump @weaponcop_end2

:weaponcop632
wait 0
03CF: load_wav 48232 as 1
03CF: load_wav 48223 as 2
03CF: load_wav 48200 as 3
03CF: load_wav 48210 as 4
03CF: load_wav 48210 as 5
if and
03D0:   wav 1 loaded
03D0:   wav 2 loaded
03D0:   wav 3 loaded
03D0:   wav 4 loaded
03D0:   wav 5 loaded
jf @weaponcop632
jump @weaponcop056

:weaponcop056
wait 0
if or
  0@ == 31 
  0@ == 32
  0@ == 33
  0@ == 34
  0@ == 35
  0@ == 36
  0@ == 37
jf @weaponcop057
jump @weaponcop8900

:weaponcop057
wait 0
if or
  0@ == 18 
  0@ == 25
  0@ == 26
  0@ == 27
  0@ == 28
  0@ == 29
  0@ == 30
jf @weaponcop058
jump @weaponcop8900

:weaponcop058
wait 0
if or
  0@ == 38 
  0@ == 39
  0@ == 16
jf @weaponcop555
jump @weaponcop8900


:weaponcop8900
0209: 26@ = random_int_in_ranges 1 3 
if 
  26@ == 1
jf @weaponcop8901 
0949: link_wav 1 to_actor 4@
03D1: play_wav 1
jump @weaponcop890 

:weaponcop8901 
if 
  26@ == 2
jf @weaponcop8900
0949: link_wav 2 to_actor 4@
03D1: play_wav 2
jump @weaponcop890

:weaponcop890
wait 0
model.Load(#COLT45)
00BC: show_text_highpriority GXT 'COPWP4' time 2000 flag 1  // ~s~Come back between 9:00 and 17:00.
01B2: give_actor 4@ weapon 22 ammo 999 // Load the weapon model before using this
0635: AS_actor 4@ aim_at_actor $PLAYER_ACTOR -1 ms
wait 2000
040D: unload_wav 1
040D: unload_wav 2
040D: unload_wav 3
040D: unload_wav 4
8@ = 0
23@ = 300
jump @weaponcop888 

:weaponcop888
if
001D:   22@ > 23@  // (int)
jf @weaponcop887
01E5: show_text_1number_highpriority GXT 'COPWP2' number 23@ time 3000 flag 1  // ~s~You need $~1~ to compete.
jump @weaponcop891 

:weaponcop887
01E5: show_text_1number_highpriority GXT 'COPWP6' number 23@ time 2000 flag 1  // ~s~You need $~1~ to compete.
jump @weaponcop894

:weaponcop891
wait 0
if
02A0:   actor $PLAYER_ACTOR stopped
jf @weaponcop894
03F0: enable_text_draw 1
03E3: set_texture_to_be_drawn_antialiased 1 
038D: draw_texture 3 position 320.0 90.0 scale 130.0 130.0 RGBA 8@ 8@ 8@ 8@ 
jump @weaponcop892

:weaponcop892
8@ += 1
if
   8@ >= 255
jf @weaponcop893
jump @weaponcop228

:weaponcop893
if
00E1:   key_pressed 3 touch_panel 4 
jf @weaponcop4341
06AB: set_actor $PLAYER_ACTOR all_weapons_hidden 1
0992: set_player $PLAYER_CHAR weapons_scrollable 0
0812: AS_actor $PLAYER_ACTOR perform_animation "policemod2" IFP "weaponcop" framedelta 4.0 loopA 0 lockX 1 lockY 0 lockF 1 time 0
0172: 6@ = actor $PLAYER_ACTOR Z_angle 
000B: 6@ += 180.0
04C4: store_coords_to 1@ 2@ 3@ from_actor $PLAYER_ACTOR with_offset 0.0 1.3 0.0
07CD: AS_actor 4@ walk_to 1@ 2@ 3@ stop_with_angle 6@ within_radius 0.0
wait 1000
jump @weaponcop896

:weaponcop4341
if
0457:   player $PLAYER_CHAR aiming_at_actor 4@
jf @weaponcop891
jump @weaponcop894

:weaponcop894
wait 0
0992: set_player $PLAYER_CHAR weapons_scrollable 1
0792: disembark_instantly_actor 4@
010D: set_player $PLAYER_CHAR wanted_level_to 2
model.Destroy(#COLT45)
wait 500
0391: release_txd_dictionary 
jump @weaponcop_end

:weaponcop896
wait 0
if 
02A0:   actor 4@ stopped
jf @weaponcop897
jump @weaponcop895

:weaponcop897
if
0104:   actor $PLAYER_ACTOR near_actor 4@ radius 10.0 10.0 5.0 sphere 0
jf @weaponcop898
jump @weaponcop899

:weaponcop899
if
actor.Dead(4@)
jf @weaponcop900
jump @weaponcop898

:weaponcop900
if
actor.Dead($PLAYER_ACTOR)
jf @weaponcop896
jump @weaponcop_end3

:weaponcop898
0812: AS_actor $PLAYER_ACTOR perform_animation "nopay" IFP "weaponcop" framedelta 4.0 loopA 0 lockX 1 lockY 0 lockF 0 time 0
jump @weaponcop_end3

:weaponcop895
15@ = Object.Create(1212, 0.0, 0.0, 0.0)5
0647: AS_actor 4@ clear_look_task
0639: AS_actor 4@ rotate_to_actor $PLAYER_ACTOR
wait 0
0812: AS_actor 4@ perform_animation "pay2" IFP "weaponcop" framedelta 4.0 loopA 0 lockX 1 lockY 0 lockF 1 time -1
01E5: show_text_1number_highpriority GXT 'COPWP1' number 23@ time 2000 flag 1  // ~s~You need $~1~ to compete.
23@ *= -1
Player.Money($PLAYER_CHAR) += 23@
23@ *= -1
0812: AS_actor $PLAYER_ACTOR perform_animation "policemod3" IFP "weaponcop" framedelta 4.0 loopA 0 lockX 1 lockY 0 lockF 0 time 0
model.Destroy(#COLT45)
wait 3000
070A: AS_actor 4@ attach_to_object 15@ offset 0.08 0.05 -0.04 on_bone 5 16 perform_animation "NULL" IFP_file "NULL" time -1
wait 1500
object.Destroy(15@)
jump @weaponcop_end3

:weaponcop555
0209: 26@ = random_int_in_ranges 1 3 
if 
  26@ == 1
jf @weaponcop556 
0949: link_wav 3 to_actor 4@
03D1: play_wav 3
jump @weaponcop5 

:weaponcop556 
if 
  26@ == 2
jf @weaponcop555
0949: link_wav 4 to_actor 4@
03D1: play_wav 4
jump @weaponcop5

:weaponcop5
wait 0  
model.Load(18985)
00BC: show_text_highpriority GXT 'COPWP5' time 2000 flag 1  // ~s~Come back between 9:00 and 17:00.
0172: 6@ = actor $PLAYER_ACTOR Z_angle 
000B: 6@ += 180.0
04C4: store_coords_to 1@ 2@ 3@ from_actor $PLAYER_ACTOR with_offset 0.0 1.3 0.0
07CD: AS_actor 4@ walk_to 1@ 2@ 3@ stop_with_angle 6@ within_radius 0.0
wait 2000
040D: unload_wav 1
040D: unload_wav 2
040D: unload_wav 3
040D: unload_wav 4
04C4: store_coords_to 1@ 2@ 3@ from_actor $PLAYER_ACTOR with_offset 0.0 1.3 0.0
07CD: AS_actor 4@ walk_to 1@ 2@ 3@ stop_with_angle 6@ within_radius 0.0
jump @weaponcop7

:weaponcop7
if
02A0:   actor $PLAYER_ACTOR stopped
jf @weaponcop228
wait 0
if
02A0:   actor 4@ stopped
jf @weaponcop201
jump @weaponcop707

:weaponcop707 
model.Available(18985)
0639: AS_actor $PLAYER_ACTOR rotate_to_actor 4@ 
0639: AS_actor 4@ rotate_to_actor $PLAYER_ACTOR
0647: AS_actor 4@ clear_look_task
wait 0
0812: AS_actor 4@ perform_animation "policemod1" IFP "weaponcop" framedelta 4.0 loopA 1 lockX 1 lockY 0 lockF 1 time -1
00BC: show_text_highpriority GXT 'COPWP3' time 3000 flag 1  // ~s~Come back between 9:00 and 17:00.
06AB: set_actor $PLAYER_ACTOR all_weapons_hidden 1
0992: set_player $PLAYER_CHAR weapons_scrollable 0
8@ = 0
jump @weaponcop8

:weaponcop201
if
0104:   actor $PLAYER_ACTOR near_actor 4@ radius 10.0 10.0 5.0 sphere 0
jf @weaponcop_end3
jump @weaponcop202

:weaponcop202
if or
actor.Dead(4@)
actor.Dead($PLAYER_ACTOR)
jf @weaponcop250
jump @weaponcop_end3

:weaponcop250
if
0457:   player $PLAYER_CHAR aiming_at_actor 4@
jf @weaponcop7
jump @weaponcop228

:weaponcop8
if
00E1:   key_pressed 3 touch_panel 4 
jf @weaponcop9
14@ = object.Create(18985, 0.0, 0.0, 0.0)
0812: AS_actor $PLAYER_ACTOR perform_animation "license1" IFP "weaponcop" framedelta 4.0 loopA 0 lockX 1 lockY 0 lockF 0 time -1
0812: AS_actor 4@ perform_animation "license2" IFP "weaponcop" framedelta 4.0 loopA 0 lockX 1 lockY 0 lockF 1 time -1
wait 2000
070A: AS_actor 4@ attach_to_object 14@ offset 0.0 0.0 0.0 on_bone 6 16 perform_animation "NULL" IFP_file "NULL" time -1
wait 3000
object.Destroy(14@)
model.Destroy(18985)
jump @weaponcop_end3

:weaponcop9
wait 0
if
02A0:   actor $PLAYER_ACTOR stopped
jf @weaponcop228
03F0: enable_text_draw 1
03E3: set_texture_to_be_drawn_antialiased 1 
038D: draw_texture 3 position 320.0 90.0 scale 130.0 130.0 RGBA 8@ 8@ 8@ 8@
jump @weaponcop10

:weaponcop10
8@ += 1
if
   8@ >= 255
jf @weaponcop8
jump @weaponcop228

:weaponcop_end3
0792: disembark_instantly_actor 4@
0647: AS_actor 4@ clear_look_task
Actor.RemoveReferences(4@)
wait 1000
0992: set_player $PLAYER_CHAR weapons_scrollable 1
0391: release_txd_dictionary 
jump @weaponcop1

:weaponcop228
wait 0
model.Destroy(18985)
0992: set_player $PLAYER_CHAR weapons_scrollable 1
0792: disembark_instantly_actor 4@
010D: set_player $PLAYER_CHAR wanted_level_to 1
jump @weaponcop_end
